set unique value validation for laravel form request

44

set unique value validation for laravel form request -

use Illuminate\Validation\Rule;

public function rules()
{
    return [
	    'title' => [
		    'required',
		    Rule::unique('posts', 'title')->ignore($this->post)
	    ]
    ]; 
}

Comments

Submit
0 Comments